import type { SelectedImage } from '~/composables/imageCropper'
import mitt from 'mitt'
/* eslint-disable  ts/consistent-type-definitions */
// 定义事件类型
type Events = {
  'crop-file': SelectedImage
  'croped-file': SelectedImage // 事件名: 事件参数类型
  'download-checked': string
  'compressImageToKB': number
  'compressImageToPercentage': number
  'compressImageToMaxSide': number
  'compressImageToWidth': number
  'compressImageToHeight': number
  'cropImageByRatio': [number, number]
}
/* eslint-enable  ts/consistent-type-definitions */
// 创建事件总线
const eventBus = mitt<Events>()

export default eventBus
